home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / asm / cmos.exe / CMOS.ASM < prev    next >
Assembly Source File  |  1991-09-21  |  7KB  |  202 lines

  1. comment 
  2.  
  3. CMOS data dump program (public domain)
  4.  
  5.  Location     Purpose
  6.  00           The count of seconds in binary coded decimal.  Minutes, hours,
  7.               day of month, month and year are BCD also.
  8.  02           The count of minutes
  9.  04           The hour
  10.  07           The day of month
  11.  08           The month
  12.  09           The last two digits of the year
  13.  0a           7       = 1 update in progress
  14.               6 - 4   = divider identifying the time based frequency to use
  15.               3 - 0   = rate selection bits that define output
  16.                         frequency and periodic interrupt rate
  17.  
  18.  0b           7       = 0 run (update cycle)
  19.                       = 1 abort any update cycle in progress
  20.               6       = 1 enable periodic interrupt
  21.               5       = 1 enable alarm interrupt
  22.               4       = 1 enable update-ended interrupt
  23.               3       = 1 enable square wave frequency set in status reg a
  24.               2       = 1 calendar is in binary format
  25.                       = 0 calendar is bcd format
  26.               1       = 1 24-hour clock
  27.                       = 0 12-hour clock
  28.               0       = 1 enable daylight savings time
  29.  
  30.  0c           7 - 4   = irqf, pf, af, and uf flags - only valid if
  31.                         alarm interrupt, update-ended interrupt, or
  32.                         periodic interrupt is enabled
  33.               3 - 0     reserved
  34.  
  35.  0d           7       = 1 real time clock has power
  36.               6 - 0     reserved
  37.  
  38.  0e           7       = 1 real time clock lost power
  39.               6       = 1 cmos checksum bad
  40.               5       = 1 invalid configuration info found at POST
  41.               4       = 1 memory size compare error detected at POST
  42.               3       = 1 fixed disk or adapter fails init
  43.               2       = 1 cmos time found invalid
  44.               1       = 1 reserved
  45.               0       = 1 reserved
  46.  
  47.  0f           7 - 0   = 0 power on or soft reset
  48.                       = 1 memory size test pass
  49.                       = 2 memory test pass
  50.                       = 3 memory test fail
  51.                       = 4 post end - boot system
  52.                       = 5 jump dword pointer (40:67) with EOI
  53.                       = 6 protected mode tests pass
  54.                       = 7 protected mode tests fail
  55.                       = 8 memory size fail
  56.                       = 9 int 15h block mode
  57.                       = 10 jump dword pointer (40:67) without EOI
  58.                       = 11 used by 386 (I think OS/2 and windows 3.0
  59.                            use this to reload system from disk)
  60.  
  61.  10           The first digit is the type of drive A: and the second digit is
  62.               the drive B: type.  (0 = not installed, 1 = 360K, 2 = 1.2M, 3 =
  63.               720K, 4 = 1.44M)
  64.  12           These are hex digits that indicate the drive type for each of the
  65.               two fixed disks in the system (0 = not installed, 1 = type 1,
  66.               ..., E = type 14).  If the digit is F (type 15 is reserved by
  67.               IBM), then location 19 indicates the drive type for fixed disk 0
  68.               and location 1A indicates the drive type for fixed disk 1.
  69.  15             base memory in 1k, low byte
  70.  16             base memory in 1k, high byte
  71.  17             expansion memory in 1k, low byte
  72.  18             expansion memory in 1k, high byte
  73.  19             (see above for location 12)
  74.  1a             (see above for location 12)
  75.  1b - 2d        reserved (used in PS/2 machines for SLOT ids, pos register data)
  76.  
  77.  2e             high byte of checksum for locations 10h to 2dh
  78.  2f             low byte of checksum for locations 10h to 2dh
  79.  30             low byte of actual expansion memory size
  80.  31             high byte of actual expansion memory size
  81.  32             century (in bcd)
  82.  33             information flag
  83.  34 to 3f       reserved (used in PS/2 for power on password/checksum storage)
  84.  
  85.  Any locations subsequent to 3f (if available) presumably have meaning only for
  86.  the particular machine that uses them.
  87.  
  88.  
  89.  
  90.  
  91. code            segment
  92.                 assume  cs:code
  93.                 org     100h
  94.  
  95. entry:          call    crlf
  96.                 call    space
  97.                 mov     cx,16
  98.  
  99. header:         call    space
  100.                 call    space
  101.                 call    space
  102.                 mov     dx,16
  103.                 sub     dx,cx
  104.                 call    outdigit
  105.                 loop    header
  106.  
  107.                 call    crlf
  108.                 sub     ax,ax
  109.                 mov     cl,4
  110.  
  111. nextbyte:       push    ax
  112.                 cmp     ax,128
  113.                 je      alldone
  114.                 call    cmosread
  115.                 mov     dx,ax
  116.                 pop     ax
  117.                 test    ax,0fh
  118.                 jnz     spaces
  119.                 call    crlf
  120.                 push    ax
  121.                 push    dx
  122.                 mov     dx,ax
  123.                 shr     dl,cl
  124.                 call    outdigit
  125.                 pop     dx
  126.                 pop     ax
  127.  
  128. spaces:         call    space
  129.                 call    space
  130.                 call    outhex
  131.                 inc     ax
  132.                 jmp     short nextbyte
  133.  
  134. alldone:        call    crlf
  135.                 int     20h
  136.  
  137. cmosread        proc    near
  138.                 out     70h,al
  139.                 jmp     short $+2
  140.                 in      al,71h
  141.                 ret
  142. cmosread        endp
  143.  
  144. cmoswrite       proc    near
  145.                 out     70h,al
  146.                 jmp     short $+2
  147.                 mov     al,ah
  148.                 out     71h,al
  149.                 ret
  150. cmoswrite       endp
  151.  
  152. crlf            proc    near
  153.                 push    ax
  154.                 push    dx
  155.                 mov     ah,2
  156.                 mov     dl,13
  157.                 int     21h
  158.                 mov     dl,10
  159.                 int     21h
  160.                 pop     dx
  161.                 pop     ax
  162.                 ret
  163. crlf            endp
  164.  
  165. space           proc    near
  166.                 push    ax
  167.                 push    dx
  168.                 mov     ah,2
  169.                 mov     dl,' '
  170.                 int     21h
  171.                 pop     dx
  172.                 pop     ax
  173.                 ret
  174. space           endp
  175.  
  176. outhex          proc    near
  177.                 push    ax
  178.                 push    dx
  179.                 and     dl,0f0h
  180.                 shr     dl,cl
  181.                 call    outdigit
  182.                 pop     dx
  183.                 and     dl,0fh
  184.                 call    outdigit
  185.                 pop     ax
  186.                 ret
  187. outhex          endp
  188.  
  189. outdigit        proc    near
  190.                 mov     ah,2
  191.                 cmp     dl,9
  192.                 ja      letter
  193.                 add     dl,'0'
  194.                 jmp     short od_exit
  195. letter:         add     dl,'A' - 10
  196. od_exit:        int     21h
  197.                 ret
  198. outdigit        endp
  199.  
  200. code            ends
  201.                 end     entry
  202.